---
title: Configuration.pipeline()
api: Configuration.pipeline
---

## Description

<Summary/>

Sub-pipelines are pipelines that can be created from other pipelines during the processing of a stream. They can be created by referring to their names. Pipeline layout names are unique within a module, but can be duplicated across different modules. Therefore, to refer to a pipeline layout inside the current module, only its name is necessary, but to refer to a pipeline layout in a different module (as in the case of [Configuration.use()](/reference/api/Configuration/use)), the module's filename is also needed.

After calling this method on a _Configuration_, the newly created pipeline layout would become current. Any _filter-creating_ methods called after this point would append filters to that pipeline layout, until another _pipeline-layout-creating_ method is called.

## Syntax

``` js
pipy()
  .pipeline()
  .filterA()
  .filterB()
  // ...

pipy()
  .pipeline(name)
  .filterA()
  .filterB()
  // ...
```

## Parameters

<Parameters/>

## Example

``` js
pipy()

  // Start listening on 8080
  .listen(8080)
  .fork('send-and-forget') // Clone the TCP stream to a new 'send-and-forget' sub-pipeline
  .serveHTTP(
    new Message('Hello!') // Respond with a hello
  )

  // Defines a sub-pipeline layout named 'send-and-forget'
  .pipeline('send-and-forget')
  .connect('localhost:8000') // Send the stream to a remote host
```

## See Also

* [Configuration](/reference/api/Configuration)
* [listen()](/reference/api/Configuration/listen)
* [read()](/reference/api/Configuration/read)
* [task()](/reference/api/Configuration/task)
